home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / internet-tools / connect-line / cl / devkit / c / examples / pmbs2cl / system.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-10  |  1.9 KB  |  88 lines

  1. //
  2. // Prometheus <-> Connectline Konverter, system.c
  3. // 
  4. // Copyright 1995 by Mathias Mischler
  5. //
  6.  
  7. #include "all.h"
  8.  
  9. //
  10. // ConvertPMBSSystem
  11. // 
  12.  
  13. void ConvertPMBSSystem ( void ) 
  14. {
  15. BPTR file = Open ( PMBSSystemList, MODE_OLDFILE );
  16. char boxname [ 22 ], domain [ 42 ], pmroute [ 22 ], passwort [ 22 ];
  17. char telefon [ 42 ], modeminit [ 22 ];
  18. WORD w;
  19. LONG i;
  20. struct Box box;
  21.  
  22.     if ( !file )
  23.     {
  24.         PutStr ( "Fehler: Kann Brettliste " PMBSSystemList " nicht öffnen.\n" );
  25.         return;
  26.     }
  27.  
  28.     CLS_LoadList ();
  29.     CLS_LockList ( TRUE );
  30.  
  31.     PutStr ( "Scanne Systemliste:\n" );
  32.  
  33.     while ( FRead ( file, &w, 2, 1 ) > 0 )
  34.     {
  35.         if ( !w )
  36.         {
  37.             while ( ( i = FGetC ( file ) ) == 0 ); // ??? Martin ???
  38.             if ( i < 0 ) break;
  39.         }
  40.     
  41.       FRead ( file, boxname, 20, 1 );
  42.         FRead ( file, domain, 40, 1 );
  43.         FRead ( file, pmroute, 20, 1 );
  44.         FRead ( file, passwort, 20, 1 );
  45.         FRead ( file, telefon, 40, 1 );
  46.         FRead ( file, modeminit, 20, 1 );
  47.         FRead ( file, &w, 2, 1 ); // Netztyp
  48.         FRead ( file, &w, 2, 1 ); // Packer
  49.         FRead ( file, &w, 2, 1 ); // Protokoll
  50.         FRead ( file, &w, 2, 1 ); // Frei
  51.         FRead ( file, &w, 2, 1 ); // Eilmail
  52.         FRead ( file, &i, 4, 1 ); // Flags
  53.  
  54.         if ( CLS_FindBox ( boxname ) )
  55.         {
  56.             Printf ( "System %s ist bereits im CL-System eingetragen.\n", boxname );
  57.             continue;
  58.         }
  59.  
  60.         Printf ( "Trage System %s ein.\n", boxname );
  61.  
  62.         memset ( &box, 0, sizeof ( struct Box ) ); 
  63.          
  64.         strcpy ( box.boxname, boxname );
  65.         if ( domain [ 0 ] == '.' ) 
  66.             strcpy ( box.boxtext, domain + 1);
  67.         else
  68.             strcpy ( box.boxtext, domain );
  69.         strcpy ( box.outserver, pmroute );
  70.         strcpy ( box.netzname, "JANUS" );
  71.         strcpy ( box.xprprotosend, "ZMODEM" );
  72.         strcpy ( box.packerin, "LHA" ); 
  73.         strcpy ( box.packerout, "LHA" ); 
  74.         strcpy ( box.telefon, telefon );
  75.         strcpy ( box.password, passwort );
  76.         box.flags = BOX_MAPS | BOX_BACKUP | BOX_EXTPROTO;
  77.  
  78.         CLS_AddEntry ( &box );
  79.     } 
  80.  
  81.     Close ( file );
  82.  
  83.     CLS_UnlockList ();
  84.     CLS_SaveList ();
  85.  
  86.     PutStr ( "Systemliste übertragen.\n\n" );
  87. }
  88.